<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <div th:include="public/css"></div>
    <style>
        .help-icon{
            margin-left:10px;
            margin-right: 10px;
        }
        .help-icon:hover{
            cursor: pointer;
        }
    </style>
</head>
<body>


<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend><span th:switch="${vo}">
        <span th:case="null">新增</span>
        <span th:case="*">编辑</span>
    </span>任务</legend>
</fieldset>

<form class="layui-form" action="/Stock/doUpdate" method="post">
    <div class="layui-form-item">
        <div class="layui-form-item">
            <label class="layui-form-label">股票名称</label>
			<div class="layui-input-inline">
                <input type="text" name="stockName" th:value="${vo?.stockName}"   placeholder="请输入股票名称" autocomplete="off" class="layui-input" >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">股票代码</label>
            <div class="layui-input-inline">
                <input type="text" name="stockCd" th:value="${vo?.stockCd}"   placeholder="股票代码" autocomplete="off" class="layui-input" >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">买入价格</label>
            <div class="layui-input-inline">
                <input type="text" name="buyPrice" th:value="${vo?.buyPrice}"   placeholder="买入价格" autocomplete="off" class="layui-input" >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">初始止损价格</label>
            <div class="layui-input-inline">
                <input type="text" name="stopLossPrice" th:value="${vo?.stopLossPrice}"    autocomplete="off" class="layui-input" onblur="countNum(this)">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">止损金额</label>
            <div class="layui-input-inline">
                <input type="text" name="quantity" th:value="${vo?.lossAt}"   placeholder="损失金额" autocomplete="off" class="layui-input" on>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">数量</label>
            <div class="layui-input-inline">
                <input type="text" name="quantity" th:value="${vo?.quantity}"   placeholder="数量" autocomplete="off" class="layui-input" >
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
		    <label class="layui-form-label">买入理由</label>
		    <div class="layui-input-inline">
		       <input type="text" name="buyReason" th:value="${vo?.buyReason}"    autocomplete="off" class="layui-textarea" >
    		</div>
    	</div>
    	<div class="layui-form-item">
		    <div class="layui-inline">
		      <label class="layui-form-label">买入日期</label>
		      <div class="layui-input-inline">
		        <input type="text" class="layui-input" id="test1" name="buyDate" placeholder="yyyyMMdd">
		      </div>
		    </div>
		</div>
  </div>
    </div>
    <input type="hidden" name="id" th:value="${vo?.id}">
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="form1">提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

</body>
<div th:include="public/js"></div>

<script>
    layui.use(['form'], function(){
        var form = layui.form
            ,layer = layui.layer;

        //监听提交
        form.on('submit(form1)', function(data){
            api.post("/Stock/doUpdate",data.field);
            return false;
        });

        $('.help-icon').hover(function () {
            layer.tips('查看帮助', '.help-icon', {
                tips: 1
            });
        },function(){});

        $('.help-icon').on('click',function(){
            layer.open({
                type: 2,
                title: 'cron表达式帮助',
                shadeClose: true,
                shade: false,
                maxmin: true, //开启最大化最小化按钮
                area: ['893px', '500px'],
                content: '/CronTask/help'
            });
        });


    });

</script>
<script src="//res.layui.com/layui/dist/layui.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
layui.use('laydate', function(){
  var laydate = layui.laydate;
  
  //常规用法
  laydate.render({
    elem: '#test1'
    ,format: 'yyyyMMdd'
  });
});

function countNum(price) {
    alert(price)
}
</script>
</html>